-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Left TODO] Support PaddleSeg deployment #39
Conversation
felixhjh
commented
Jul 25, 2022
•
edited
Loading
edited
- 支持 PaddleSeg 六个模型的部署(Deeplabv3-ResNet50, hrnet-w18, pp-humanseg, pp-humanseg-server, PP-LiteSeg, unet)
- 支持三种模型导出形式(logits matrix, logits matrix with argmax, logits matrix with argmax and with softmax)
- 支持visualization
Fix bug while the inference result is empty with YOLOv5 (PaddlePaddle#29)
…into PaddlePaddle-develop
std::map<std::string, std::array<int, 2>>* im_info) { | ||
FDASSERT(infer_result.dtype == FDDataType::INT64 || | ||
infer_result.dtype == FDDataType::FP32, | ||
"Require the data type of output is int64 or fp32, but now it's " + | ||
Str(const_cast<fastdeploy::FDDataType&>(infer_result.dtype)) + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是不是可以直接写成Str(infer_result.dtype)
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个hwc2chw是不是可以直接改成opencv的操作
for (int i = 0; i < height; i++) { | ||
for (int j = 0; j < width; j++) { | ||
temp_mat.at<float_t>(i, j) = | ||
static_cast<float_t>(infer_result_buffer[index++]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processor的这个函数建议按照功能模块拆一下,提升可读性
int64_t chw = channel * height * width; | ||
int64_t* infer_result_buffer = static_cast<int64_t*>(infer_result.Data()); | ||
std::vector<float_t> float_result_buffer(chw); | ||
temp_mat = cv::Mat(height, width, CV_32FC(channel)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int64出来的结果,转为了float的来进行后面的resize处理,这个部署的结果是否跟PaddleSeg对齐了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这么做的原因有二:
- int64的结果出来的是类别的mask矩阵,对于pp-human系列也就是0,1矩阵(其他也就是0-num_classes的矩阵)。opencv没有64位的矩阵变量,因此必须要转。
- 转为float是因为,resize的插值方式双线性策略(inter=1,也是前处理所使用的策略)只支持float类型opencv mat(不支持int、uint8精度缺失)。为保持前后处理一致所以统一转为float。
- PaddleSeg给到的三张示例图片,正常人像、竖屏人像、横屏人像fastdeploy结果与PaddleSeg是一致的,后续evaluation模块开发完成(正在去除Paddle依赖)会跑全量
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
第3点, 先确认输出的值(numpy) 与 PaddleSeg是一致的,并做到与Seg结果一致
|